home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 …ember: Reference Library / Apple Developer Reference Library (December 1999) (Disk 1).iso / pc / technical documentation / develop / develop issue 26 / develop issue 26 code / truffles - display mgr. / sprocket / interfaces / threadcontext.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-30  |  1.1 KB  |  53 lines

  1. /*
  2.     File:        ThreadContext.h
  3.  
  4.     Contains:    An abstract class for threads
  5.                 
  6.     Written by: Steve Sisak
  7.     
  8.     Copyright:    © 1995 by Steve Sisak, all rights reserved.
  9.  
  10.     Change History (most recent first):
  11.      
  12.  */
  13. #ifndef    _THREADCONTEXT_
  14. #define    _THREADCONTEXT_
  15.  
  16. #ifndef    __THREADS__
  17. #include <Threads.h>
  18. #endif
  19.  
  20. #ifdef    __MWERKS__
  21. #include <MWException.h>
  22. #endif
  23.  
  24. class    TThreadContext
  25. {
  26. protected:
  27.     ThreadID        fThreadID;
  28.     void*            fThreadResult;
  29.  
  30. #ifdef    __MWERKS__
  31.     ExceptionState    fSavedState;
  32.     ExceptionState    fExceptionState;
  33.     char            fCatchBuffer[CATCH_BUFSIZE];
  34. #endif
  35.  
  36. public:
  37.                     TThreadContext(void);
  38.     virtual            ~TThreadContext();
  39.  
  40.     virtual void    CreateThread(ThreadStyle threadStyle, ThreadEntryProcPtr threadEntry, Size stackSize, ThreadOptions options);
  41.  
  42.     virtual void    SwitchIn(void);
  43.     virtual void    SwitchOut(void);
  44.     virtual void    Terminate(void);
  45.     
  46. protected:
  47.     static pascal void SwitchInProc(ThreadID threadBeingSwitched, void *switchProcParam);
  48.     static pascal void SwitchOutProc(ThreadID threadBeingSwitched, void *switchProcParam);
  49.     static pascal void TerminationProc(ThreadID threadTerminated, void *terminationProcParam);
  50. };
  51.  
  52. #endif
  53.